package dataobjects;

public class Position {

	private int x;
	private int y;
	private Direction dir;
	
	public Position(int x, int y){
		 this(x, y, Direction.UNKNOWN);
	}

	public Position(int x, int y, Direction dir){
		this.x = x;
		this.y = y;
		this.dir = dir;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public Direction getDir() {
		return dir;
	}

	public void setDir(Direction dir) {
		this.dir = dir;
	}
	
	@Override
	public boolean equals(Object obj){
		if (obj instanceof Position){
			Position pos = (Position) obj;
			if (pos.getX() == this.getX() && pos.getY() == this.getY()){
				return true;
			}
		}
		return false;
	}
	
	@Override
	public int hashCode(){
		//TODO: come up with something better than this, will work for now
		return x * 37 + y;
	}
}
